package com.shopping.strategy.impl;

import com.shopping.strategy.BasePromotion;

import java.math.BigDecimal;

/**
 * @author wdx
 * @desc 优惠卷活动策略  满100减10
 */
public class CouponPromotionStrategy implements BasePromotion {

    private final static Integer FILL_HUNDRED = 100;

    private final static Integer Fill_HUNRED_REDUCE = 10;

    @Override
    public Object doPromotion(Object context) {
        BigDecimal amount = (BigDecimal) context;
        if (amount.compareTo(BigDecimal.valueOf(FILL_HUNDRED)) >= 0) {
            amount = amount.subtract(BigDecimal.valueOf(Fill_HUNRED_REDUCE));
        }
        return amount;
    }
}
